'use strict'
//引入react
import React from 'react';
//引入react-dom
import {render} from 'react-dom';
//引入react路由
import {Router,Route,Link,IndexRedirect,hashHistory} from 'react-router';
// bootstrap
import 'node_modules/bootstrap/dist/css/bootstrap.min.css';
// import 'node_modules/bootstrap/dist/js/bootstrap.min.js';
// bootstrap sb-admin-2 主题
import 'node_modules/sb-admin-2/dist/css/sb-admin-2.min.css';
// font-awesome 字体
import 'node_modules/font-awesome/css/font-awesome.min.css';

import Home            from 'page/home/index.jsx';
import Parent          from 'page/parent/index.jsx';
import Login           from 'page/login/index.jsx';
import ProductList     from 'page/product/index/index.jsx';
import ProductSave     from 'page/product/index/save.jsx';
import ProductDetail   from 'page/product/index/detail.jsx';
import ProductCategory from 'page/product/category/index.jsx';
import AddCategory     from 'page/product/category/add.jsx';
import OrderList       from 'page/order/index.jsx';
import OrderDetail     from 'page/order/detail.jsx';
//渲染路由

render(
    <Router history={hashHistory}>
        <Route path="/" >
            {/*home*/}
            <IndexRedirect to="home" />
            <Route path="home" component = {Parent} >
                <IndexRedirect to="index" />
                <Route path="index" component = {Home}/>
            </Route>
            <Route path="login" component = {Login}  />
            <Route path="product" component = {Parent} >
                <IndexRedirect to="index" />
                <Route path="index" component = {ProductList}/>
                <Route path="save(/:id)" component = {ProductSave}/>
                <Route path="detail(/:id)" component = {ProductDetail}/>
            </Route>
            <Route path="product.category" component={Parent}>
                <IndexRedirect to='index' />
                <Route path='index(/:id)' component={ProductCategory} />
                <Route path='add' component={AddCategory} />
            </Route>
            <Route path="order" component={Parent}>
                <IndexRedirect to='index' />
                <Route path='index' component={OrderList} />
                <Route path='detail(/:orderNo)' component={OrderDetail} />
            </Route>
        </Route>
    </Router>, 
    document.getElementById('app')
)